#include "InitialAngleSimul.h"

#include "TrajSimul.h"

#include <cmath>
#include <iostream>
#include <sstream>
#include <fstream>

using namespace std;

InitialAngleSimul::InitialAngleSimul(Clock clock,Output output,Pulse * field,Pulse *pulse,MultiLayer multiLayer)
{
  Parameters *p=Parameters::getInstance();
  double angle=0,angle2=0;
  int layerNumber=multiLayer.getSolveLayer();
  for(angle=p->getDouble("l1_initialAngle");angle<=p->getDouble("l1_finalAngle");angle+=p->getDouble("l1_angleStep"))
    {
      Vector3 tempVector;
      tempVector.setX(sin(angle*M_PI/180)*cos(angle2*M_PI/180));
      tempVector.setY(sin(angle*M_PI/180)*sin(angle2*M_PI/180));
      tempVector.setZ(cos(angle*M_PI/180));
      mag.setMag(tempVector);
      ostringstream myfile;
      myfile<<angle;
      /*sys.outputfile="sample1_ani00_h00_i100_angle";
      sys.outputfile.append(myfile.str());
      sys.outputfile.append("_.txt");
      ofstream myfiles;
      myfiles.open(sys.timeoutput.c_str(), ios::out | ios::app);
      myfiles<<angle<<"\t";
      myfiles.close();*/
      TrajSimul().solve(clock,output,field,pulse,mag,pol);
    }
}

InitialAngleSimul::~InitialAngleSimul()
{

}
